#pragma once

#include <logger/memorystream.hpp>

#include "GeneratedFiles/ui/ui_OutputWidget.h"




namespace Engine
{
	namespace Edit
	{
		class OutputWidget
			: public QWidget
		{
		public:

			/**
			 * Creates an OutputWidget.
			 * The widget displays the output from 
			 */
			OutputWidget(QWidget* parent);
			virtual ~OutputWidget();



			/**
			 * Attaches the widget to the output from the given stream.
			 */
			void attach(logger::memorystream::ptr stream);

			/**
			 * Detaches the widget from the attached stream.
			 * Does nothing if it's not attached to a stream.
			 */
			void detach();

		protected:

			/**
			 * This slot is connected to the pending signal of the memorystream.
			 */
			void pending();

		private:

			::Ui::OutputWidget            ui;
			logger::memorystream::ptr     m_stream;
			boost::signals2::connection   m_connection;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
